# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgbase=polkit-qt
pkgname=(polkit-qt5
         polkit-qt6)
pkgver=0.175.0
pkgrel=1
pkgdesc='A library that allows developers to access PolicyKit API with a nice Qt-style API'
arch=(loong64 x86_64)
url='https://www.kde.org/'
license=(LGPL)
depends=(gcc-libs
         glib2
         glibc
         polkit)
makedepends=(cmake
             qt5-base
             qt6-base)
source=(https://download.kde.org/stable/$pkgbase-1/$pkgbase-1-$pkgver.tar.xz{,.sig})
sha256sums=('73a32d1a1819684145e0ef8a1f2ea804f9ec10ad78d62aa03bad4dbdb39c4c99'
            'SKIP')
validpgpkeys=(D81C0CB38EB725EF6691C385BB463350D6EF31EF) # Heiko Becker <heirecka@exherbo.org>

build() {
  cmake -B build5 -S $pkgbase-1-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr
  cmake --build build5

  cmake -B build6 -S $pkgbase-1-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT_MAJOR_VERSION=6
  cmake --build build6
}

package_polkit-qt5() {
  depends+=(qt5-base)

  DESTDIR="$pkgdir" cmake --install build5
}

package_polkit-qt6() {
  depends+=(qt6-base)

  DESTDIR="$pkgdir" cmake --install build6
}
